package jiaxa.com.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by jiaxa on 2017/11/15.
 */

public class MyDbOpenHelper extends SQLiteOpenHelper {
    public MyDbOpenHelper(Context content) {
        super(content, "jiaxadb", null, 2);
    }

    //    public MyDbOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
    //        super(context, name, factory, version);
    //    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        System.out.println("onCreate 数据库被创建了");
        db.execSQL("CREATE TABLE [contactInfo] ([id] INTEGER NOT NULL, [name] VARCHAR(32) NOT NULL);");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        System.out.println("onCreate 数据库被更新了");
        db.execSQL("alter table [contactInfo] add [account] varchar(20);");
    }
}
